﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.Unity.Configuration;
using Microsoft.Practices.Unity;

using Arquitetura.Architectural.IoC;

namespace Arquitetura.Architectural.Service
{
    public abstract class Service :
        Arquitetura.Architectural.Service.IService
    {
        #region Atributo(s)
        private IUnityContainer m_unityContainer;
        #endregion Atributo(s)

        #region Construtor(es)
        public Service()
        {
            m_unityContainer = new UnityContainer();
            m_unityContainer.LoadDefaultConfig();
        }

        public Service(IUnityContainer unityContainer)
        {
            m_unityContainer = unityContainer;
        }
        #endregion Construtor(es)

        protected T Resolve<T>()
        {
            return m_unityContainer.Resolve<T>();
        }
    }
}
